//
//  Transform.hpp
//  RenderV1
//
//  Created by 黄翔 on 2019/10/20.
//  Copyright © 2019 黄翔. All rights reserved.
//

#ifndef Transform_h
#define Transform_h

#include <vector>
#include "HMath.h"
#include "GameObject.h"
#include "ReferenceCounted.h"

namespace hxe {
    class GameObject;

    class Transform : public ReferenceCounted
    {
    public:
        Vector3 position;
        Vector3 scale;

        Vector3 forward;
        Vector3 up;
        Vector3 right;

        GameObject* gameObject;
      
    public:
        Transform(GameObject* gameObject);
        virtual ~Transform();

        void setEulerAngles(const Vector3& eulerAngles);
        Matrix4x4 getMatrix() const;

        void setParent(Transform* parent);
        Transform* getParent() const;

        int getChildCount() const;
        Transform* find(std::string name);
        Transform* getChild(unsigned int index);

    private:
        void removeFromParent();

    private:
        std::vector<Transform*> children;
        Transform* parent;
    };
}


#endif /* Transform_h */
